
/*
* This file is define some link table for vlan_info ;
*/

#include "l2tp.h"

struct l2tp_info *create_link_list(void)
{
	struct l2tp_info * link;

	link = (struct l2tp_info *)malloc (sizeof(struct l2tp_info)) ;
	if(link == NULL){
		perror("malloc error");
		exit(1) ;
	}
	link->next = NULL ;
	
	return link ;
}

void print_list(struct l2tp_info *head)
{
	if(head == NULL)
	{
		printf("NULL link list \n");
	}
	else
	{
		while(head != NULL)
		{
			head = head->next ;
		}
	}
}

int insert_link_list(struct l2tp_info *head, struct l2tp_info *insert)
{
	struct l2tp_info *tmp = NULL;
	
	if(head == NULL)
	{
		printf("head NULL \n");
		return 0 ;
	}

	tmp = head ;
	
	while(head->next != NULL) //Notice: this place must be phead's Next ;
		head = head->next ;
		
	
	head->next = insert ;
	head = tmp ;
	return 1 ;
}